<?php
include("config.php");

$jaka_ankieta = $_POST["jaka_ankieta"];
$query = mysql_query("SELECT * FROM ankiety WHERE id = '$jaka_ankieta'");

while ($rekord = mysql_fetch_assoc($query))
{
$id = $rekord['id'];
$tytul = $rekord['tytul'];
$answer1 = $rekord['answer1'];
$answer2 = $rekord['answer2'];
$answer3 = $rekord['answer3'];

//print "<p>ID: $id | LOGIN: $login | HASLO: $haslo</p>";

//echo '<p>Ankieta: '.$tytul.'</p>';
//echo '<p>ID ankiety: '.$id.'</p>';

//echo '<input type="radio" name="111" value="male">'.$answer1.'<br>';
//echo '<input type="radio" name="111" value="female">'.$answer2.'<br>';
//echo '<input type="radio" name="111" value="female">'.$answer3.'<br>';

echo '
<br />
<table align="center" cellspacing="10px" style="border: 1px solid black;" >
<form action="?kategoria=zaglosuj" method="post">
<tr>
  <td><p>Ankieta: '.$tytul.'</p></td>
  <td><p>ID ankiety: '.$id.'</p></td>
</tr>

<input type="hidden" name="id" value="'.$id.'">

<tr>
  <td align="left"><input type="radio" name="glosowanie" value="1">'.$answer1.'<br></td>
</tr>

<tr>
  <td align="left"><input type="radio" name="glosowanie" value="2">'.$answer2.'<br></td>
</tr>

<tr>
  <td align="left"><input type="radio" name="glosowanie" value="3">'.$answer3.'<br></td>
</tr>

<tr>
  <td><input type="submit" name="wyslij" value="Wyślij ankietę!"/></td>
</tr>

</form>
</table >

<table align="center">
<tr>
	<td>
	<form action="?kategoria=wyniki" method="post">
	<input type="hidden" name="jaka_ankieta" value="'.$jaka_ankieta.'">
	<input type="submit" name="wyniki" value="Pokaż wyniki!"/></td>
	</form>
	</td>
</tr>
</table>
';


}

?>
